package com.huanxing.cloud.security.entity;

import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * 用户扩展信息
 *
 * @author lijx
 * @since 2022/2/10 11:46
 */
public class HuanxingUser extends User {
  private String userId;

  /** -1、系统管理员；1、租户管理员；2、店铺管理员 */
  @Getter private String type;

  /** 租户ID */
  @Getter private String tenantId;
  /** 店铺ID */
  @Getter private String shopId;

  public HuanxingUser(
      String userId,
      String type,
      String tenantId,
      String shopId,
      String username,
      String password,
      boolean enabled,
      boolean accountNonExpired,
      boolean credentialsNonExpired,
      boolean accountNonLocked,
      Collection<? extends GrantedAuthority> authorities) {
    super(
        username,
        password,
        enabled,
        accountNonExpired,
        credentialsNonExpired,
        accountNonLocked,
        authorities);
    this.userId = userId;
    this.type = type;
    this.tenantId = tenantId;
    this.shopId = shopId;
  }

  public String getUserId() {
    return userId;
  }

  public void setUserId(String userId) {
    this.userId = userId;
  }
}
